Add test for running Log input as Filestream in Beatsreceivers#11155
Add test for running Log input as Filestream in Beatsreceivers#11155belimawr merged 67 commits intoelastic:mainfrom
Conversation
|
This pull request is now in conflicts. Could you fix it? 🙏 |
|
This pull request does not have a backport label. Could you fix it @belimawr? 🙏
|
|
The tests are failing because in my last commit I modified |
There was a problem hiding this comment.
Pull request overview
Adds an integration test to validate that Beats receivers can restart using Filestream (via feature flag) while continuing ingestion from the prior Log input offset.
Changes:
- Added a new integration test + Otel config template to validate Log → Filestream restart behavior with no duplication.
- Refactored ES API key creation helper to be
*testing.T-aware and reuset.Context(). - Improved infra/helpers: stricter
ELASTICSEARCH_HOSTvalidation, unzip overwrite flag, and newFixture.Stop()support.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/integration/ess/testdata/filebeat_receiver_log_as_filestream.yml | Adds Otel YAML template used by the new Log→Filestream integration test |
| testing/integration/ess/otel_test.go | Refactors ES API key helper to assert internally and use t.Context() |
| testing/integration/ess/otel_log_as_filestream_test.go | Adds new integration test validating restart Log→Filestream continues from same offset |
| testing/integration/ess/beat_receivers_test.go | Updates to new createESApiKey(t, client) helper signature |
| testing/integration/common.go | Makes GetESHost() fail fast when ELASTICSEARCH_HOST is unset |
| pkg/testing/linux/linux.go | Uses unzip -o to avoid interactive prompts on overwrite |
| pkg/testing/fixture.go | Adds Fixture.Stop() and stores process handle for external stopping |
Comments suppressed due to low confidence (1)
pkg/testing/fixture.go:1
- This used to be
Fatalbut is nowError, which allows execution to continue even though the code relies on a deadline to avoid hanging. Either keep it asFatalor return an error immediately after logging so the fixture cannot run without a deadline.
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
testing/integration/ess/testdata/filebeat_receiver_log_as_filestream.yml
Outdated
Show resolved
Hide resolved
testing/integration/ess/testdata/filebeat_receiver_log_as_filestream.yml
Outdated
Show resolved
Hide resolved
swiatekm
left a comment
There was a problem hiding this comment.
Other than needing more guards for the fixture addition, this looks good to me.
…gent into log-run-as-filestream
Co-authored-by: Mauri de Souza Meneguzzo <[email protected]>
mauri870
left a comment
There was a problem hiding this comment.
LGTM, and thanks for adjusting the other tests!
💛 Build succeeded, but was flaky
Failed CI StepsHistory
cc @belimawr |
What does this PR do?
This PR adds a test that ensures Beatsreceivers ingesting logs can:
Currently there is no way to run a Beatreceiver directly from a standalone Beats binary, hence the test in this repo.
Why is it important?
It allows us to run the Filestream input instead of the Log input for a Log input configuration
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added an entry in./changelog/fragmentsusing the changelog toolAuthor's Checklist
dev-tools/notice/overrides.jsongo.modtesting/integration/ess/logfile.gowith the functionality provided by Add TempDir and NewLogFile test utilities elastic-agent-libs#369## Disruptive User ImpactHow to test this PR locally
Running integration tests
Run the test:
TestFilebeatReceiverLogAsFilestreamfromtesting/integration/ess/otel_log_as_filestream_test.goManual test
Run the Elastic Agent in Otel mode setting
features.log_input_run_as_filestream.enabled: truefor the filebeatreceiver you want to test.Package the Elastic Agent for your OS
Create a log file
Extract and run Elastic Agent in otel mode using a configuration like the one below
otel.yml
Related issues
Questions to ask yourself